import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
//Home同步路由  页面初次加载会将所有的模块进行加载
//About异步路由 可以减少首屏渲染的速度
import City from '../views/City.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/about',
    name: 'About',
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')//进入f12控制台network会加载about.js
  },
  /* 异步路由相关的信息是打印不到的，从city界面可以看到，回到home就看不到了 */
  {
    path:'/city',
    name:'City',
    component:City,//进入f12控制台network不会加载about.js
    //用同步组件 
    //App导航栏不显示
    meta:{
      isNav:true
    }
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
